package com.ethan.androidroom;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import java.util.List;

public
/**
 * @Description:
 * @Author ethan
 * @CreateDate: 2021/12/17 16:33
 * @UpdateDate: 2021/12/17 16:33
 * @Version 1.0
 */
@Dao
interface UserDao {
    @Query("SELECT * FROM user")
    List<User> getAll();

    @Query("SELECT * FROM user WHERE uid IN (:userIds)")
    List<User> loadAllByIds(int[] userIds);

    @Query("SELECT * FROM user WHERE first_name LIKE :first AND " +
            "last_name LIKE :last LIMIT 1")
    User findByName(String first, String last);

    @Insert
    List<Long> insertAll(User... users);
    @Insert
    Long insert(User users);
    @Delete
    void delete(User user);
}
